﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Exam.Core;

public partial class Manage_Service_delpaper : ManagePageBase
{
    Exam.Core.DAL.Paper dal = new Exam.Core.DAL.Paper();
    protected void Page_Load(object sender, EventArgs e)
    {
        string result = "0";
        string idlist = "";
        if (Request.Form["id"] != null && Request.Form["id"].Trim() != "") {
            idlist = Request.Form["id"].Trim(',');
            string[] paperFileNames = dal.getPaperFileName(idlist);
            foreach (string str in paperFileNames) {
                if (str.Trim() != "") {
                    string path = FilePath.PaperPath.Trim() + str.Trim();
                    if (File.Exists(path)) {
                        File.Delete(path);
                    }
                }
            }
            if (dal.Delete(idlist.Trim())) {
                
                result = "1";
            }
        }
        Response.Write(result);
        Response.End();
    }
}